PROP_INVISIBLE,
PROP_PARAGRAPH_BACKGROUND,
PROP_PARAGRAPH_BACKGROUND_GDK,
+
+ /* Behavior args */
+ PROP_ACCUMULATIVE_MARGIN,
/* Whether-a-style-arg-is-set args */
PROP_BACKGROUND_SET,
GDK_TYPE_COLOR,
GTK_PARAM_READWRITE));
+ /**
+ * GtkTextTag:accumulative-margin:
+ *
+ * Whether the margins accumulate or override each other.
+ *
+ * When set to %TRUE the margins of this tag are added to the margins
+ * of any other non-accumulative margins present. When set to %FALSE
+ * the margins override one another (the default).
+ *
+ * Since: 2.12
+ */
+ g_object_class_install_property (object_class,
+ PROP_ACCUMULATIVE_MARGIN,
+ g_param_spec_boolean ("accumulative-margin",
+ P_("Margin Accumulates"),
+ P_("Whether left and right margins accumulate."),
+ FALSE,
+ GTK_PARAM_READWRITE));
+
/* Style props are set or not */
#define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (object_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, GTK_PARAM_READWRITE))
}
break;
+ case PROP_ACCUMULATIVE_MARGIN:
+ text_tag->accumulative_margin = g_value_get_boolean (value);
+ g_object_notify (object, "accumulative-margin");
+ size_changed = TRUE;
+ break;
+
/* Whether the value should be used... */
case PROP_BACKGROUND_SET:
g_value_set_boxed (value, tag->values->pg_bg_color);
break;
+ case PROP_ACCUMULATIVE_MARGIN:
+ g_value_set_boolean (value, tag->accumulative_margin);
+ break;
+
case PROP_BACKGROUND_SET:
g_value_set_boolean (value, tag->bg_color_set);
break;
{
guint n = 0;
+ guint left_margin_accumulative = 0;
+ guint right_margin_accumulative = 0;
+
g_return_if_fail (!dest->realized);
while (n < n_tags)
if (vals->direction != GTK_TEXT_DIR_NONE)
dest->direction = vals->direction;
- if (tag->left_margin_set)
- dest->left_margin = vals->left_margin;
+ if (tag->left_margin_set)
+ {
+ if (tag->accumulative_margin)
+ left_margin_accumulative += vals->left_margin;
+ else
+ dest->left_margin = vals->left_margin;
+ }
if (tag->indent_set)
dest->indent = vals->indent;
if (tag->rise_set)
dest->appearance.rise = vals->appearance.rise;
- if (tag->right_margin_set)
- dest->right_margin = vals->right_margin;
+ if (tag->right_margin_set)
+ {
+ if (tag->accumulative_margin)
+ right_margin_accumulative += vals->right_margin;
+ else
+ dest->right_margin = vals->right_margin;
+ }
if (tag->pixels_above_lines_set)
dest->pixels_above_lines = vals->pixels_above_lines;
++n;
}
+
+ dest->left_margin += left_margin_accumulative;
+ dest->right_margin += right_margin_accumulative;
}
gboolean